//
//  ViewController.m
//  Test
//
//  Created by 孙叔康
//

#import "ViewController.h"
#import "SKGreeterClient.h"
#import "TimeUtils.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.view.backgroundColor = UIColor.orangeColor;
//    [TimeUtils dateStringWithStr]
}

- (IBAction)btnClick:(UIButton *)sender {
    /// 问候语对应的SKGreeterClient实例初始化
    SKGreeterClient *greetClient = [SKGreeterClient new];
    NSString *meetingMsg = [greetClient greetingMessage];
    NSLog(@"问候语消息=%@",meetingMsg);
    
    
    //问题2：如果要满足测试，需要不同的时间来计算(测试单个时间)
    NSString *testDateStr = @"2022年07月28日09:24";
    NSString *startTimeStr = [TimeUtils dateStringWithStr:testDateStr defaultdateFormat:@"yyyy年MM月dd日HH:mm" NewDateFormat:@"yyyy年MM月dd日HH"];
    NSDate *testDate = [TimeUtils timeDateWithString:startTimeStr format:@"yyyy年MM月dd日HH"];
    NSString *testMeetingMsg = [greetClient greetingMessageWithDate:testDate];
    NSLog(@"问候语消息2=%@",testMeetingMsg);
}

/// 问题2：如果要满足测试，需要不同的时间来计算
- (IBAction)moreTestActionClick:(UIButton *)sender {
    SKGreeterClient *greetClient = [SKGreeterClient new];
    for (int i = 1; i<24; i++) {
        NSString *hourInt = [NSString stringWithFormat:@"%02d",i];
        //@"2022年07月28日09:24"
        NSString *testDateStr = [NSString stringWithFormat:@"2022年07月28日%@:20",hourInt];
        NSString *startTimeStr = [TimeUtils dateStringWithStr:testDateStr defaultdateFormat:@"yyyy年MM月dd日HH:mm" NewDateFormat:@"yyyy年MM月dd日HH"];
        NSDate *testDate = [TimeUtils timeDateWithString:startTimeStr format:@"yyyy年MM月dd日HH"];
        NSString *testMeetingMsg = [greetClient greetingMessageWithDate:testDate];
        NSLog(@"问候语消息2 %@=%@",testDateStr,testMeetingMsg);
    }
}


@end
